Oh no, it's Another Test::Run Update!

Shlomi Fish on 2007-03-18T06:57:13

A lot of work has been done on Test-Run since the last update and I'd like to summarise it here.

I discovered that when running runprove (the Test::Run prove counterpart), without any command line arguments then it barfed with weird and confusing errors. I fixed it to exit gracefully without any message in a similar manner to prove.

Next, on 12 March, I converted the code to make use of TAP::Parser 0.51, which is the new release of TAPx::Parser, that broke some compatibility with older versions. Then I released Test-Run 0.0105.

I also did a lot of refactoring: removing unused variables, putting classes in their own .pm modules, extracting methods, moving methods to specialised classes (instead of passing data from one method to the other) and converting arguments to instance properties.

I mentioned the alternate interpreters plugin in my previous entry. Well, I continued to work on it, and released the first few versions on the CPAN. The first two releases were broken, and I received automated smoking failure reports for them despite the fact I quickly uploaded newer packages.

This weekend (Friday and Saturday) I was sick, but I guess every cloud has a silver lining because I was able to get a lot of work done. During these two days I've done 68 commits to the repository, and had a diff in which I added 2,602 lines and removed (or replaced) 431 lines. (Many of the added lines are copy-and-paste, template-generated, moves and renames, or otherwise small tweaks, though). It's been a while since I felt I was so productive.

I also worked and released Test-Run-Plugin-CollectStats, which collects and stores data and statistics from the entire test run. I initially feared it was hard, but it turned out to be easier than I expected. Doing it properly involved documenting the meaning of the fields of some of the struct-like classes I stored there.

I did some work on the Test-Run homepage and made it somewhat less embarrassing. Then I added it to Freshmeat and announced a release.

I joined irc.perl.org's #parrot to witness the fun of the Parrot bug day, and while I was in the neighbourhood decided to write a patch for Parrot to have an option of making use of Test::Run to run its tests. It took me some time to find out what to change, but after I did, the coding itself was very easy. I submitted a patch to the bug tracker, and it was applied less than an hour later. Gee, I love open source!

After guiding one of the people who chatted there on how to get Test::Run configured and to output in colour, he asked how to get the verdicts of the individual test files ("ok", "NOK", "dubious", etc.) in colour as well. I told him one will have to write a plugin for that, and then decided to do it myself. This involved more refactoring to the core Test::Run code, and I'm still working on it. While I did, I refactored on of the methods to be this:

sub _get_dubious_message_components
{
    my $self = shift;

    return 
    [
           $self->_get_dubious_message_ml()
        ,  $self->_get_dubious_verdict_message()
        ,  $self->_get_dubious_message_line_end() 
        ,  $self->_get_dubious_status_message_indent_prefix()
        ,  $self->_get_dubious_status_message()
    ];
}

While _get_dubious_message_line_end and _get_dubious_status_message_indent_prefix to read:

sub _get_dubious_message_line_end
{
    return "\n";
}

sub _get_dubious_status_message_indent_prefix
{
    return "\t";
}

Don't look at me - it seemed like the right thing to do!

Next on my agenda is:

  1. Finish the plugin that colours the test file components, and release it.
  2. Write a freshmeat.net announcement with all the new stuff.
  3. Write a plugin based on ::CollectStats that serialises the data to XML. Write an XSLT stylesheet to transform it into DocBook/XML.

That's all folks! Have a lot of fun!